package hczc.longcai.com.hccrowdfunding.home.fourth_mine.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;

/**
 * Created by Administrator on 2016/1/29.
 */
public class SponserSpinnerAdapter extends BaseAdapter {

    private Context context;
    private String[] strings;

    public SponserSpinnerAdapter(Context context, String[] strings) {
        this.context = context;
        this.strings = strings;
    }

    @Override
    public int getCount() {
        return strings.length;
    }

    @Override
    public Object getItem(int position) {
        return strings[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHoder hoder = null;
        if(convertView == null){
            hoder = new ViewHoder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_sponser_spinner,null);
            BaseApplication.scaleScreenHelper.loadView(((ViewGroup) convertView));
            hoder.textView = ((TextView) convertView.findViewById(R.id.sponser_spinner));
            convertView.setTag(hoder);
        }
        hoder = ((ViewHoder) convertView.getTag());
        hoder.textView.setText(strings[position]);
        return convertView;
    }

    class ViewHoder{
        TextView textView;
    }
}
